
<?php
 function truncateString_($str, $len, $charset="UTF-8"){
        $str = html_entity_decode($str, ENT_QUOTES, $charset);   
        if(mb_strlen($str, $charset)> $len){
            $arr = explode(' ', $str);
            $str = mb_substr($str, 0, $len, $charset);
            $arrRes = explode(' ', $str);
            $last = $arr[count($arrRes)-1];
            unset($arr);
            if(strcasecmp($arrRes[count($arrRes)-1], $last))   unset($arrRes[count($arrRes)-1]);
          return implode(' ', $arrRes)."...";   
       }
        return $str;
    }
?>
<div class="mw_sort">
    	<a class="sort_link_focus" href="<?php echo base_url() ?>index.php">Mới nhất</a> <a class="sort_link" href="#">Hay nhất</a> <a class="sort_link" href="#">Tải nhiều </a>
    </div>
  <?php
  foreach($data as $row)
  {
	  $image=base_url()."public/uploads/$row[image]";
	  $noidung=truncateString_($row['noidung'],200);
	  $link=base_url()."index.php/theloai/link/$row[stt]";
	  echo '<div class="list_item">';
  	echo '<div>';
    echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
        echo'<tbody><tr>';
            echo '<td width="82" valign="top" style="padding-right:10px; padding-top: 2px">';
              echo  "<a href='$link'><img border=0 width='82' height='82'  src=$image></a>";
                echo "</td>";
                echo "<td valign='top'><a class='game_link' href='$link'>$row[game]</a>";
                echo "<div class='des_txt'>";
                
                    echo "<div class='list_row'>$noidung</div>";
                    echo "<div><a href='$link'><input type='button' id='item01' class='btn_login' value='Tải game'></a></div>";
                    	 
               echo"</div>";
                
                echo "</td>";
            echo "</tr>";
        echo "</tbody></table>";
    echo "</div>";
   
  echo "</div>";
	  }
	  
  ?> 
   <div class="list_item">
  <?php  echo $this->pagination->create_links();?>
   </div>